
import combat
from time import sleep
import libtcodpy as lt

__author__="Action Farsi"
__date__ ="$24-gen-2009 11.27.44$"

def render():
    ORIGIN = (10,5)
    for j,y in enumerate(map):
        for i,x in enumerate(y):
            libtcod.console_set_back(None, i+ORIGIN[0], j+ORIGIN[1], libtcod.grey, libtcod.BKGND_SET)
            libtcod.console_set_char(None, i+ORIGIN[0], j+ORIGIN[1], ' ')
    #draw character
    libtcod.console_set_char(None, pl.position[0]+ORIGIN[0], pl.position[1]+ORIGIN[1], pl.symbol)
    libtcod.console_print_left(None, 50, 45, libtcod.BKGND_NONE, str(libtcod.sys_get_fps()))

def prova():
    lt.console_init_root(20, 20, 'AfW',False)
    c1 = lt.console_new(20,20)
    lt.console_print_left(None,2,2, lt.BKGND_NONE, "pippo")
    lt.console_print_left(c1,2,3, lt.BKGND_NONE, "prop2")
    lt.console_blit(c1,0,0,20,20,0,0,0,0.5  ,0)
    while not lt.console_is_window_closed():
        lt.console_flush()
        sleep(0.3)
        
    lt.console_delete(c1)
    
    
    
def action():
    key = libtcod.console_wait_for_keypress(True)
    if key.vk == libtcod.KEY_ESCAPE:
        return 1

    movement = (0,0)
    if key.vk == libtcod.KEY_NONE:
        return 0
    elif key.vk == libtcod.KEY_UP:
        movement = (0,-1)
    elif key.vk == libtcod.KEY_DOWN:
        movement = (0,1)
    elif key.vk == libtcod.KEY_LEFT:
        movement = (-1,0)
    elif key.vk == libtcod.KEY_RIGHT:
        movement = (1,0)

    pl.move(movement)
    return 0

def logic():
    pass


if __name__ == "__main__":
    prova()
    print "Main Module"
